package Database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.swing.JOptionPane;

public class SolutionSickness {
	String title;
	String text;
	public SolutionSickness(int idSickness)
	{
		//String space = String.format("                                                                              ");
		//String newLine = String.format("%n");
		try{
			Class.forName("com.mysql.jdbc.Driver");
			Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bmi","root","1234"); 
			Statement statement = con.createStatement();
			ResultSet rs = statement.executeQuery("select * from sickness where idSickness = '" + idSickness + "'");
            if (rs.next()) {
            	title = rs.getString(2);
            	text = rs.getString(3);
            }
			statement.close();
			con.close();
		}catch (Exception e) 
		{
			JOptionPane.showMessageDialog(null,e);
		}
	}
	public String getText()
	{
		return text;
	}
	public String getTitle()
	{
		return title;
	}
}
